From: Florian Müllner Date: Tue, 20 Aug 2019 02:24:37 +0000 (+0200) Subject: style: Allow lonely ifs where appropriate X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~415 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a32c4f30d15e2aec3b93947e0ea7cb3138babe13;p=gnome-shell.git style: Allow lonely ifs where appropriate We now have a lint rule to disallow lonely ifs, however there are cases where the "lonely" part mirrors code from the preceding if clause. Opt out of the lint rule in those cases. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/818 --- diff --git a/js/gdm/util.js b/js/gdm/util.js index 107e8f776..824b301b9 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -544,6 +544,7 @@ var ShellUserVerifier = class { }); } } else { + // eslint-disable-next-line no-lonely-if if (!this.hasPendingMessages) { this._cancelAndReset(); } else { diff --git a/js/misc/util.js b/js/misc/util.js index cbbd4455a..b7ee01798 100644 --- a/js/misc/util.js +++ b/js/misc/util.js @@ -250,7 +250,7 @@ function formatTime(time, params) { format = N_("%B %-d %Y, %H\u2236%M"); } else { // Show only the time if date is on today - if (daysAgo < 1 || params.timeOnly) + if (daysAgo < 1 || params.timeOnly) // eslint-disable-line no-lonely-if /* Translators: Time in 12h format */ format = N_("%l\u2236%M %p"); // Show the word "Yesterday" and time if date is on yesterday diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index 9f8ee2825..a5e6c22d7 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -346,6 +346,7 @@ var Magnifier = class Magnifier { this.addCrosshairs(); this._crossHairs.show(); } else { + // eslint-disable-next-line no-lonely-if if (this._crossHairs) this._crossHairs.hide(); } diff --git a/js/ui/overview.js b/js/ui/overview.js index dc9565d02..3f22a47b4 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -534,6 +534,7 @@ var Overview = class { } } } else { + // eslint-disable-next-line no-lonely-if if (this._modal) { Main.popModal(this._overview); this._modal = false; diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 65dc78a22..2f9cd0e2b 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -964,6 +964,7 @@ class NMWirelessDialog extends ModalDialog.ModalDialog { else if (wpaFlags & NM80211ApSecurityFlags.KEY_MGMT_PSK) type = NMAccessPointSecurity.WPA_PSK; } else { + // eslint-disable-next-line no-lonely-if if (flags & NM80211ApFlags.PRIVACY) type = NMAccessPointSecurity.WEP; else diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index e6d6d60f0..41544ee7b 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -2124,7 +2124,7 @@ var WindowManager = class { else direction = Meta.MotionDirection.LEFT; } else { - if (vertical) + if (vertical) // eslint-disable-line no-lonely-if direction = Meta.MotionDirection.DOWN; else if (rtl) direction = Meta.MotionDirection.LEFT;